
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define MAX_LINE 1024
 
int main()
{
	char buf[MAX_LINE];  
	FILE* fp; 
	if ((fp = fopen("myfile.txt", "r")) == NULL)
	{
		perror("fail to read");
		exit(1);
	}
    int i=0;
	while (fgets(buf, MAX_LINE, fp) != NULL)
	{
		i++;
		printf("%d %s", i, buf);
	}
	return 0;}
